Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

Not quite as you are thinking, but similar.

The point is that you do have to declare a variable that is to hold the reference to the NotesDocument object. But, unlike you are assuming, the declaration does not need to be local in the function that is called. It can just as well be in the calling script.

A simple example below demonstrates the difference.

Sub Initialize
Const WELL_KNOWN_UNID$ = "8D0665FAED38C10DC1256DCB007AD8B4" 'Replace with your own
Dim doc As NotesDocument
' This will produce "Still there":
Call Test(doc, WELL_KNOWN_UNID)
' This will produce "Gone with the wind!":
Call Test(Nothing, WELL_KNOWN_UNID)
End Sub

Sub Test(rDoc As NotesDocument, rUnid As String)
Dim s As New NotesSession()
Set rDoc = s.CurrentDatabase.GetDocumentByUnid(rUnid)
If rDoc Is Nothing Then
MsgBox "Gone with the wind!"
Else
MsgBox "Still there"
End If
End Sub

FWIW, it does not make any difference whether you access the document via GetDocumentByUnid() or by a lookup in a view. (Although there may be other reasons not to use GetDocumentByUnid(), as Willy argued.)


Feedback response number JSAK959T2S created by ~Chris Frofootherobu on 02/25/2013

GetDocumentByUNID - no error, no do... (~Mark Nonjipyst... 21.Feb.13)
. . On Error Resume Next (~Fred Xanjumima... 21.Feb.13)
. . . . good point, but... (~Mark Nonjipyst... 22.Feb.13)
. . . . . . could be finding a deletion stub...... (~Justin Chugero... 22.Feb.13)
. . NotesView GetDocumentByKey doesn't ... (~Mark Nonjipyst... 22.Feb.13)
. . solution - declare notesdocument lo... (~Mark Nonjipyst... 25.Feb.13)
. . . . Not quite as you are thinking, but ... (~Fred Asatumibu... 25.Feb.13)
. . . . . . Well, shucks (~Mark Nonjipyst... 25.Feb.13)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS